﻿namespace TheSafety.Dialogs
{
    using OpenVPN;
    using System;
    using System.CodeDom.Compiler;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Input;
    using System.Windows.Markup;

    [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
    public class VPNLoginPassDialog : Window, IComponentConnector
    {
        private NeedLoginAndPasswordEventArgs a;
        internal TextBox b;
        internal PasswordBox c;
        internal Label d;
        internal Label e;
        internal Button f;
        private bool g;

        public VPNLoginPassDialog(NeedLoginAndPasswordEventArgs A_0)
        {
            this.InitializeComponent();
            this.a();
            this.a = A_0;
        }

        private void a()
        {
            this.f.Content = "OK";
            this.d.Content = e.c("UsernameVPN") + ":";
            this.e.Content = e.c("PasswordVPN") + ":";
            base.Title = e.c("LoginPassWindowTitle");
        }

        [EditorBrowsable(EditorBrowsableState.Never), DebuggerNonUserCode]
        private void a(int A_0, object A_1)
        {
            switch (A_0)
            {
                case 1:
                    ((VPNLoginPassDialog) A_1).Closing += new CancelEventHandler(this.Window_Closing);
                    ((VPNLoginPassDialog) A_1).Loaded += new RoutedEventHandler(this.Window_Loaded);
                    ((VPNLoginPassDialog) A_1).KeyDown += new KeyEventHandler(this.Window_KeyDown);
                    return;

                case 2:
                    this.b = (TextBox) A_1;
                    return;

                case 3:
                    this.c = (PasswordBox) A_1;
                    return;

                case 4:
                    this.d = (Label) A_1;
                    return;

                case 5:
                    this.e = (Label) A_1;
                    return;

                case 6:
                    this.f = (Button) A_1;
                    this.f.Click += new RoutedEventHandler(this.btnOk_Click);
                    return;
            }
            this.g = true;
        }

        private void btnOk_Click(object A_0, RoutedEventArgs A_1)
        {
            this.a.UserName = this.b.Text;
            this.a.Password = this.c.Password;
            base.Close();
        }

        [DebuggerNonUserCode]
        public void InitializeComponent()
        {
            if (!this.g)
            {
                this.g = true;
                Uri resourceLocator = new Uri("/TheSafety;component/dialogs/vpnloginpassdialog.xaml", UriKind.Relative);
                Application.LoadComponent(this, resourceLocator);
            }
        }

        private void Window_Closing(object A_0, CancelEventArgs A_1)
        {
            this.a.UserName = this.b.Text;
            this.a.Password = this.c.Password;
        }

        private void Window_KeyDown(object A_0, KeyEventArgs A_1)
        {
            if (A_1.Key == Key.Return)
            {
                this.btnOk_Click(A_0, null);
            }
        }

        private void Window_Loaded(object A_0, RoutedEventArgs A_1)
        {
            base.Focus();
        }
    }
}

